import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[] elem = new int[n+1];
            for (int i = 0; i < elem.length - 1; i++) {
                elem[i] = scanner.nextInt();
            }
            int ret = count(elem);
            System.out.println(ret);
        }
    }

    private static int count(int[] nums) {
        int count = 0;
        int i = 0;
        while (i < nums.length - 1) {
            if (nums[i] < nums[i + 1]) {
                while (i < nums.length - 1 && nums[i] < nums[i + 1]) {
                    i++;
                }
                count++;
                i++;
            } else if (nums[i] == nums[i + 1]) {
                i++;
            } else {
                while (i < nums.length - 1&& nums[i] > nums[i + 1]) {
                    i++;
                }
                count++;
                i++;
            }
        }
        return count;
    }
}
